/**
 * 文件工具类
 */
class FileUtil{
  //获取文件名
  static String getFileName({String? filePath}){
    if(filePath==null)return'';
    List<String> filePaths = filePath.split('/');
    if(filePaths.length==0){
      return '';
    }else if(filePaths.length<2){
      return filePaths[0];
    }else{
      return filePaths[filePaths.length-1];
    }
  }

  //获取文件前缀
  static String getFileNamePreSuffix({String? fileName}){
    if(fileName==null)return'';
    List<String> filePaths = fileName.split('.');
    if(filePaths.length==0){
      return '';
    }else if(filePaths.length<2){
      return filePaths[0];
    }else{
      return filePaths[0];
    }
  }
  //获取文件后缀
  static String getFileNameSuffix({String? fileName}){
    if(fileName==null)return'';
    List<String> fileNames = fileName.split('.');
    if(fileNames.length==0){
      return '';
    }else if(fileNames.length<2){
      return fileNames[0];
    }else{
      return fileNames[fileNames.length-1];
    }
  }
}
